package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] array = {"1","2","3","4","5"};
        for (int i = 0;i < array.length;i++){
            System.out.println(array[i]);
        }
        for (String str : array){
            System.out.println(str);
        }
        System.out.println("----------------------------------------");
        Collection<String> c = new ArrayList<>();
        c.add("1");
        c.add("2");
        c.add("3");
        c.add("4");
        c.add("5");
        Iterator it = c.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (String str : c){
            System.out.println(str);
        }
    }
}
